Page({
  data: {
    _observer: null
  },

  onLoad() {
    const intersectionObserver = wx.createIntersectionObserver(
      this,
      { thresholds: [0.3, 0.7] }
    )
    this.setData(
      { _observer: intersectionObserver },
      () => {
        intersectionObserver.relativeToViewport()
          .observe('#target-view', res => console.log(+new Date(), res))
      }
    )
  },

  onUnload() {
    this.data._observer && this.data._observer.disconnect()
  }
})